
class PrintChar {
  constructor(char,num) {
    this.char = char;
    this.num = num;
  }

  for1(){
    for(var i=this.num;i>0;i--){
      if (i%2) {

      }else {
        let result = "";
        for(var k =i;k > 0; k--)result += this.char;
        console.log(result);
      }
    }
  }
  for2(){
    let result=""; let a= (this.num+1)/2; let kongge = " ";let result2 = "";
    for(var i=a; i>1; i--){
      if (i==a) {
        for(var j=1; j<a; j++)result += " ";
        result +=this.char;
        console.log(result);
      }else {
          let result1 ="";
          for(var x=1;x<i;x++)result1 +=" ";
          result1 += this.char;
          result1 += kongge;
          result1 += this.char;
          console.log(result1);
          kongge +=" ";
          kongge +=" ";
      }
    }
    if (this.num%2) {
      for (var y=0; y<this.num; y++) {
        result2 += this.char;
      }
      console.log(result2);
    }else {
      for (var y=0; y<=this.num; y++) {
        result2 += this.char;
      }
      console.log(result2);
    }
  }
}
var p1 = new PrintChar("A",10);
p1.for1();
console.log("-----------------------");
p1.for2();
